blob: 6b4a182e29e613bb2638a4c4271bf5f6d95fb7cc [file] [log] [blame]
Junio C Hamano1a4e8412005-12-27 08:17:231<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
2 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
4<head>
5<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
Junio C Hamanoba4b9282008-07-06 05:20:316<meta name="generator" content="AsciiDoc 8.2.5" />
Junio C Hamano1a4e8412005-12-27 08:17:237<style type="text/css">
8/* Debug borders */
9p, li, dt, dd, div, pre, h1, h2, h3, h4, h5, h6 {
10/*
11 border: 1px solid red;
12*/
13}
14
15body {
16 margin: 1em 5% 1em 5%;
17}
18
Junio C Hamanoba4b9282008-07-06 05:20:3119a {
20 color: blue;
21 text-decoration: underline;
22}
23a:visited {
24 color: fuchsia;
25}
Junio C Hamano1a4e8412005-12-27 08:17:2326
27em {
28 font-style: italic;
29}
30
31strong {
32 font-weight: bold;
33}
34
35tt {
36 color: navy;
37}
38
39h1, h2, h3, h4, h5, h6 {
40 color: #527bbd;
41 font-family: sans-serif;
42 margin-top: 1.2em;
43 margin-bottom: 0.5em;
44 line-height: 1.3;
45}
46
Junio C Hamanoba4b9282008-07-06 05:20:3147h1, h2, h3 {
Junio C Hamano1a4e8412005-12-27 08:17:2348 border-bottom: 2px solid silver;
49}
50h2 {
Junio C Hamano1a4e8412005-12-27 08:17:2351 padding-top: 0.5em;
52}
Junio C Hamanoba4b9282008-07-06 05:20:3153h3 {
54 float: left;
55}
56h3 + * {
57 clear: left;
58}
Junio C Hamano1a4e8412005-12-27 08:17:2359
60div.sectionbody {
61 font-family: serif;
62 margin-left: 0;
63}
64
65hr {
66 border: 1px solid silver;
67}
68
69p {
70 margin-top: 0.5em;
71 margin-bottom: 0.5em;
72}
73
74pre {
75 padding: 0;
76 margin: 0;
77}
78
79span#author {
80 color: #527bbd;
81 font-family: sans-serif;
82 font-weight: bold;
Junio C Hamanoba4b9282008-07-06 05:20:3183 font-size: 1.1em;
Junio C Hamano1a4e8412005-12-27 08:17:2384}
85span#email {
86}
87span#revision {
88 font-family: sans-serif;
89}
90
91div#footer {
92 font-family: sans-serif;
93 font-size: small;
94 border-top: 2px solid silver;
95 padding-top: 0.5em;
96 margin-top: 4.0em;
97}
98div#footer-text {
99 float: left;
100 padding-bottom: 0.5em;
101}
102div#footer-badges {
103 float: right;
104 padding-bottom: 0.5em;
105}
106
107div#preamble,
108div.tableblock, div.imageblock, div.exampleblock, div.verseblock,
109div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
110div.admonitionblock {
111 margin-right: 10%;
112 margin-top: 1.5em;
113 margin-bottom: 1.5em;
114}
115div.admonitionblock {
116 margin-top: 2.5em;
117 margin-bottom: 2.5em;
118}
119
120div.content { /* Block element content. */
121 padding: 0;
122}
123
124/* Block element titles. */
125div.title, caption.title {
126 font-family: sans-serif;
127 font-weight: bold;
128 text-align: left;
129 margin-top: 1.0em;
130 margin-bottom: 0.5em;
131}
132div.title + * {
133 margin-top: 0;
134}
135
136td div.title:first-child {
137 margin-top: 0.0em;
138}
139div.content div.title:first-child {
140 margin-top: 0.0em;
141}
142div.content + div.title {
143 margin-top: 0.0em;
144}
145
146div.sidebarblock > div.content {
147 background: #ffffee;
148 border: 1px solid silver;
149 padding: 0.5em;
150}
151
Junio C Hamanoba4b9282008-07-06 05:20:31152div.listingblock {
153 margin-right: 0%;
154}
Junio C Hamano1a4e8412005-12-27 08:17:23155div.listingblock > div.content {
156 border: 1px solid silver;
157 background: #f4f4f4;
158 padding: 0.5em;
159}
160
161div.quoteblock > div.content {
162 padding-left: 2.0em;
163}
Junio C Hamanoba4b9282008-07-06 05:20:31164
165div.attribution {
Junio C Hamano1a4e8412005-12-27 08:17:23166 text-align: right;
167}
Junio C Hamanoba4b9282008-07-06 05:20:31168div.verseblock + div.attribution {
169 text-align: left;
170}
Junio C Hamano1a4e8412005-12-27 08:17:23171
172div.admonitionblock .icon {
173 vertical-align: top;
174 font-size: 1.1em;
175 font-weight: bold;
176 text-decoration: underline;
177 color: #527bbd;
178 padding-right: 0.5em;
179}
180div.admonitionblock td.content {
181 padding-left: 0.5em;
182 border-left: 2px solid silver;
183}
184
185div.exampleblock > div.content {
186 border-left: 2px solid silver;
187 padding: 0.5em;
188}
189
190div.verseblock div.content {
191 white-space: pre;
192}
193
194div.imageblock div.content { padding-left: 0; }
195div.imageblock img { border: 1px solid silver; }
196span.image img { border-style: none; }
197
198dl {
199 margin-top: 0.8em;
200 margin-bottom: 0.8em;
201}
202dt {
203 margin-top: 0.5em;
204 margin-bottom: 0;
205 font-style: italic;
206}
207dd > *:first-child {
208 margin-top: 0;
209}
210
211ul, ol {
212 list-style-position: outside;
213}
Junio C Hamanoba4b9282008-07-06 05:20:31214div.olist2 ol {
Junio C Hamano1a4e8412005-12-27 08:17:23215 list-style-type: lower-alpha;
216}
217
218div.tableblock > table {
Junio C Hamanoba4b9282008-07-06 05:20:31219 border: 3px solid #527bbd;
Junio C Hamano1a4e8412005-12-27 08:17:23220}
221thead {
222 font-family: sans-serif;
223 font-weight: bold;
224}
225tfoot {
226 font-weight: bold;
227}
228
229div.hlist {
230 margin-top: 0.8em;
231 margin-bottom: 0.8em;
232}
Junio C Hamanoba4b9282008-07-06 05:20:31233div.hlist td {
234 padding-bottom: 5px;
235}
Junio C Hamano1a4e8412005-12-27 08:17:23236td.hlist1 {
237 vertical-align: top;
238 font-style: italic;
239 padding-right: 0.8em;
240}
241td.hlist2 {
242 vertical-align: top;
243}
244
245@media print {
246 div#footer-badges { display: none; }
247}
Junio C Hamanoba4b9282008-07-06 05:20:31248
249div#toctitle {
250 color: #527bbd;
251 font-family: sans-serif;
252 font-size: 1.1em;
253 font-weight: bold;
254 margin-top: 1.0em;
255 margin-bottom: 0.1em;
256}
257
258div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
259 margin-top: 0;
260 margin-bottom: 0;
261}
262div.toclevel2 {
263 margin-left: 2em;
264 font-size: 0.9em;
265}
266div.toclevel3 {
267 margin-left: 4em;
268 font-size: 0.9em;
269}
270div.toclevel4 {
271 margin-left: 6em;
272 font-size: 0.9em;
273}
274include1::./stylesheets/xhtml11-manpage.css[]
Junio C Hamano1a4e8412005-12-27 08:17:23275/* Workarounds for IE6's broken and incomplete CSS2. */
276
277div.sidebar-content {
278 background: #ffffee;
279 border: 1px solid silver;
280 padding: 0.5em;
281}
282div.sidebar-title, div.image-title {
283 font-family: sans-serif;
284 font-weight: bold;
285 margin-top: 0.0em;
286 margin-bottom: 0.5em;
287}
288
289div.listingblock div.content {
290 border: 1px solid silver;
291 background: #f4f4f4;
292 padding: 0.5em;
293}
294
295div.quoteblock-content {
296 padding-left: 2.0em;
297}
298
299div.exampleblock-content {
300 border-left: 2px solid silver;
301 padding-left: 0.5em;
302}
Junio C Hamanoba4b9282008-07-06 05:20:31303
304/* IE6 sets dynamically generated links as visited. */
305div#toc a:visited { color: blue; }
Junio C Hamano1a4e8412005-12-27 08:17:23306</style>
307<title>git-fetch(1)</title>
308</head>
309<body>
310<div id="header">
311<h1>
312git-fetch(1) Manual Page
313</h1>
314<h2>NAME</h2>
315<div class="sectionbody">
316<p>git-fetch -
Junio C Hamano7c73c662007-01-19 00:37:50317 Download objects and refs from another repository
Junio C Hamano1a4e8412005-12-27 08:17:23318</p>
319</div>
320</div>
321<h2>SYNOPSIS</h2>
322<div class="sectionbody">
Junio C Hamanoba4b9282008-07-06 05:20:31323<div class="para"><p><em>git fetch</em> &lt;options&gt; &lt;repository&gt; &lt;refspec&gt;&#8230;</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:23324</div>
Junio C Hamanoba4b9282008-07-06 05:20:31325<h2 id="_description">DESCRIPTION</h2>
Junio C Hamano1a4e8412005-12-27 08:17:23326<div class="sectionbody">
Junio C Hamanoba4b9282008-07-06 05:20:31327<div class="para"><p>Fetches named heads or tags from another repository, along with
328the objects necessary to complete them.</p></div>
329<div class="para"><p>The ref names and their object names of fetched refs are stored
Junio C Hamano1a4e8412005-12-27 08:17:23330in <tt>.git/FETCH_HEAD</tt>. This information is left for a later merge
Junio C Hamanoba4b9282008-07-06 05:20:31331operation done by <em>git-merge</em>.</p></div>
332<div class="para"><p>When &lt;refspec&gt; stores the fetched result in tracking branches,
Junio C Hamano8be70732007-02-10 01:28:40333the tags that point at these branches are automatically
334followed. This is done by first fetching from the remote using
335the given &lt;refspec&gt;s, and if the repository has objects that are
336pointed by remote tags that it does not yet have, then fetch
337those missing tags. If the other end has tags that point at
Junio C Hamanoba4b9282008-07-06 05:20:31338branches you are not interested in, you will not get them.</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:23339</div>
Junio C Hamanoba4b9282008-07-06 05:20:31340<h2 id="_options">OPTIONS</h2>
Junio C Hamano1a4e8412005-12-27 08:17:23341<div class="sectionbody">
Junio C Hamanoba4b9282008-07-06 05:20:31342<div class="vlist"><dl>
Junio C Hamano1a4e8412005-12-27 08:17:23343<dt>
Junio C Hamanoeb415992008-06-08 22:49:47344-a
345</dt>
346<dt>
347--append
Junio C Hamano1a4e8412005-12-27 08:17:23348</dt>
349<dd>
350<p>
351 Append ref names and object names of fetched refs to the
352 existing contents of <tt>.git/FETCH_HEAD</tt>. Without this
353 option old data in <tt>.git/FETCH_HEAD</tt> will be overwritten.
354</p>
355</dd>
356<dt>
Junio C Hamanoc21ab052009-10-31 04:03:55357--depth=&lt;depth&gt;
Junio C Hamanoe663a7a2006-01-25 12:37:28358</dt>
Junio C Hamanoe663a7a2006-01-25 12:37:28359<dd>
360<p>
Junio C Hamanoc21ab052009-10-31 04:03:55361 Deepen the history of a <em>shallow</em> repository created by
362 <tt>git clone</tt> with <tt>--depth=&lt;depth&gt;</tt> option (see <a href="git-clone.html">git-clone(1)</a>)
363 by the specified number of commits.
Junio C Hamanoe663a7a2006-01-25 12:37:28364</p>
365</dd>
366<dt>
Junio C Hamanoeb415992008-06-08 22:49:47367-f
368</dt>
369<dt>
370--force
Junio C Hamano1a4e8412005-12-27 08:17:23371</dt>
372<dd>
373<p>
Junio C Hamanoba4b9282008-07-06 05:20:31374 When <em>git-fetch</em> is used with <tt>&lt;rbranch&gt;:&lt;lbranch&gt;</tt>
Junio C Hamano1a4e8412005-12-27 08:17:23375 refspec, it refuses to update the local branch
376 <tt>&lt;lbranch&gt;</tt> unless the remote branch <tt>&lt;rbranch&gt;</tt> it
377 fetches is a descendant of <tt>&lt;lbranch&gt;</tt>. This option
378 overrides that check.
379</p>
380</dd>
381<dt>
Junio C Hamanoc21ab052009-10-31 04:03:55382-k
383</dt>
384<dt>
385--keep
386</dt>
387<dd>
388<p>
389 Keep downloaded pack.
390</p>
391</dd>
392<dt>
Junio C Hamanoeb415992008-06-08 22:49:47393-n
394</dt>
395<dt>
396--no-tags
Junio C Hamano4d04a402006-01-09 00:53:28397</dt>
398<dd>
399<p>
Junio C Hamanof7bb6692008-01-27 08:23:46400 By default, tags that point at objects that are downloaded
401 from the remote repository are fetched and stored locally.
402 This option disables this automatic tag following.
Junio C Hamano4d04a402006-01-09 00:53:28403</p>
404</dd>
405<dt>
Junio C Hamanoeb415992008-06-08 22:49:47406-t
407</dt>
408<dt>
409--tags
Junio C Hamano1a4e8412005-12-27 08:17:23410</dt>
411<dd>
412<p>
Junio C Hamano4d04a402006-01-09 00:53:28413 Most of the tags are fetched automatically as branch
414 heads are downloaded, but tags that do not point at
415 objects reachable from the branch heads that are being
416 tracked will not be fetched by this mechanism. This
417 flag lets all tags and their associated objects be
418 downloaded.
Junio C Hamano1a4e8412005-12-27 08:17:23419</p>
420</dd>
421<dt>
Junio C Hamanoeb415992008-06-08 22:49:47422-u
423</dt>
424<dt>
425--update-head-ok
Junio C Hamano1a4e8412005-12-27 08:17:23426</dt>
427<dd>
428<p>
Junio C Hamanoba4b9282008-07-06 05:20:31429 By default <em>git-fetch</em> refuses to update the head which
Junio C Hamano1a4e8412005-12-27 08:17:23430 corresponds to the current branch. This flag disables the
Junio C Hamanoba4b9282008-07-06 05:20:31431 check. This is purely for the internal use for <em>git-pull</em>
432 to communicate with <em>git-fetch</em>, and unless you are
Junio C Hamanob288d9e2007-01-02 00:04:15433 implementing your own Porcelain you are not supposed to
434 use it.
435</p>
436</dd>
437<dt>
Junio C Hamanoc21ab052009-10-31 04:03:55438--upload-pack &lt;upload-pack&gt;
Junio C Hamanob288d9e2007-01-02 00:04:15439</dt>
440<dd>
441<p>
Junio C Hamanoc21ab052009-10-31 04:03:55442 When given, and the repository to fetch from is handled
443 by <em>git-fetch-pack</em>, <em>--exec=&lt;upload-pack&gt;</em> is passed to
444 the command to specify non-default path for the command
445 run on the other end.
446</p>
447</dd>
448<dt>
449-q
450</dt>
451<dt>
452--quiet
453</dt>
454<dd>
455<p>
456 Pass --quiet to git-fetch-pack and silence any other internally
457 used git commands.
458</p>
459</dd>
460<dt>
461-v
462</dt>
463<dt>
464--verbose
465</dt>
466<dd>
467<p>
468 Be verbose.
Junio C Hamano1a4e8412005-12-27 08:17:23469</p>
470</dd>
471<dt>
472&lt;repository&gt;
473</dt>
474<dd>
475<p>
476 The "remote" repository that is the source of a fetch
Junio C Hamano054ea082008-06-01 08:26:34477 or pull operation. This parameter can be either a URL
478 (see the section <a href="#URLS">GIT URLS</a> below) or the name
479 of a remote (see the section <a href="#REMOTES">REMOTES</a> below).
Junio C Hamano1a4e8412005-12-27 08:17:23480</p>
Junio C Hamano40f2f8d2006-02-07 08:04:39481</dd>
482<dt>
483&lt;refspec&gt;
484</dt>
485<dd>
486<p>
Junio C Hamano8b6e23b2009-02-01 06:36:08487 The format of a &lt;refspec&gt; parameter is an optional plus
488 <tt>&#43;</tt>, followed by the source ref &lt;src&gt;, followed
489 by a colon <tt>:</tt>, followed by the destination ref &lt;dst&gt;.
Junio C Hamano40f2f8d2006-02-07 08:04:39490</p>
Junio C Hamanoba4b9282008-07-06 05:20:31491<div class="para"><p>The remote ref that matches &lt;src&gt;
Junio C Hamano40f2f8d2006-02-07 08:04:39492is fetched, and if &lt;dst&gt; is not empty string, the local
Junio C Hamano3f680f32009-11-16 02:10:54493ref that matches it is fast-forwarded using &lt;src&gt;.
Junio C Hamano8b6e23b2009-02-01 06:36:08494If the optional plus <tt>+</tt> is used, the local ref
Junio C Hamano3f680f32009-11-16 02:10:54495is updated even if it does not result in a fast-forward
Junio C Hamanoba4b9282008-07-06 05:20:31496update.</p></div>
Junio C Hamano40f2f8d2006-02-07 08:04:39497<div class="admonitionblock">
498<table><tr>
499<td class="icon">
500<div class="title">Note</div>
501</td>
502<td class="content">If the remote branch from which you want to pull is
503modified in non-linear ways such as being rewound and
504rebased frequently, then a pull will attempt a merge with
505an older version of itself, likely conflict, and fail.
506It is under these conditions that you would want to use
507the <tt>+</tt> sign to indicate non-fast-forward updates will
508be needed. There is currently no easy way to determine
509or declare that a branch will be made available in a
510repository with this behavior; the pulling user simply
511must know this is the expected usage pattern for a branch.</td>
512</tr></table>
513</div>
514<div class="admonitionblock">
515<table><tr>
516<td class="icon">
517<div class="title">Note</div>
518</td>
519<td class="content">You never do your own development on branches that appear
520on the right hand side of a &lt;refspec&gt; colon on <tt>Pull:</tt> lines;
Junio C Hamanoba4b9282008-07-06 05:20:31521they are to be updated by <em>git-fetch</em>. If you intend to do
Junio C Hamano40f2f8d2006-02-07 08:04:39522development derived from a remote branch <tt>B</tt>, have a <tt>Pull:</tt>
523line to track it (i.e. <tt>Pull: B:remote-B</tt>), and have a separate
524branch <tt>my-B</tt> to do your development on top of it. The latter
525is created by <tt>git branch my-B remote-B</tt> (or its equivalent <tt>git
526checkout -b my-B remote-B</tt>). Run <tt>git fetch</tt> to keep track of
527the progress of the remote side, and when you see something new
528on the remote branch, merge it into your development branch with
Junio C Hamanob288d9e2007-01-02 00:04:15529<tt>git pull . remote-B</tt>, while you are on <tt>my-B</tt> branch.</td>
Junio C Hamano40f2f8d2006-02-07 08:04:39530</tr></table>
531</div>
532<div class="admonitionblock">
533<table><tr>
534<td class="icon">
535<div class="title">Note</div>
536</td>
537<td class="content">There is a difference between listing multiple &lt;refspec&gt;
Junio C Hamanoba4b9282008-07-06 05:20:31538directly on <em>git-pull</em> command line and having multiple
Junio C Hamano40f2f8d2006-02-07 08:04:39539<tt>Pull:</tt> &lt;refspec&gt; lines for a &lt;repository&gt; and running
Junio C Hamanoba4b9282008-07-06 05:20:31540<em>git-pull</em> command without any explicit &lt;refspec&gt; parameters.
Junio C Hamano40f2f8d2006-02-07 08:04:39541&lt;refspec&gt; listed explicitly on the command line are always
542merged into the current branch after fetching. In other words,
543if you list more than one remote refs, you would be making
Junio C Hamanoba4b9282008-07-06 05:20:31544an Octopus. While <em>git-pull</em> run without any explicit &lt;refspec&gt;
Junio C Hamano40f2f8d2006-02-07 08:04:39545parameter takes default &lt;refspec&gt;s from <tt>Pull:</tt> lines, it
546merges only the first &lt;refspec&gt; found into the current branch,
547after fetching all the remote refs. This is because making an
548Octopus from remote refs is rarely done, while keeping track
549of multiple remote heads in one-go by fetching more than one
550is often useful.</td>
551</tr></table>
552</div>
Junio C Hamanoba4b9282008-07-06 05:20:31553<div class="para"><p>Some short-cut notations are also supported.</p></div>
554<div class="ilist"><ul>
Junio C Hamano40f2f8d2006-02-07 08:04:39555<li>
556<p>
557<tt>tag &lt;tag&gt;</tt> means the same as <tt>refs/tags/&lt;tag&gt;:refs/tags/&lt;tag&gt;</tt>;
558 it requests fetching everything up to the given tag.
559</p>
560</li>
561<li>
562<p>
563A parameter &lt;ref&gt; without a colon is equivalent to
564 &lt;ref&gt;: when pulling/fetching, so it merges &lt;ref&gt; into the current
565 branch without storing the remote branch anywhere locally
566</p>
567</li>
Junio C Hamanoba4b9282008-07-06 05:20:31568</ul></div>
Junio C Hamano40f2f8d2006-02-07 08:04:39569</dd>
Junio C Hamanoba4b9282008-07-06 05:20:31570</dl></div>
Junio C Hamano40f2f8d2006-02-07 08:04:39571</div>
Junio C Hamanoba4b9282008-07-06 05:20:31572<h2 id="_git_urls_a_id_urls_a">GIT URLS<a id="URLS"></a></h2>
Junio C Hamano40f2f8d2006-02-07 08:04:39573<div class="sectionbody">
Junio C Hamanoba4b9282008-07-06 05:20:31574<div class="para"><p>One of the following notations can be used
575to name the remote repository:</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:23576<div class="exampleblock">
577<div class="exampleblock-content">
Junio C Hamanoba4b9282008-07-06 05:20:31578<div class="ilist"><ul>
Junio C Hamano1a4e8412005-12-27 08:17:23579<li>
580<p>
581rsync://host.xz/path/to/repo.git/
582</p>
583</li>
584<li>
585<p>
Junio C Hamanoa3bb6eb2009-02-05 01:26:33586http://host.xz&#91;:port&#93;/path/to/repo.git/
Junio C Hamano1a4e8412005-12-27 08:17:23587</p>
588</li>
589<li>
590<p>
Junio C Hamanoa3bb6eb2009-02-05 01:26:33591https://host.xz&#91;:port&#93;/path/to/repo.git/
Junio C Hamano1a4e8412005-12-27 08:17:23592</p>
593</li>
594<li>
595<p>
Junio C Hamanoa3bb6eb2009-02-05 01:26:33596git://host.xz&#91;:port&#93;/path/to/repo.git/
Junio C Hamano1a4e8412005-12-27 08:17:23597</p>
598</li>
599<li>
600<p>
Junio C Hamanoa3bb6eb2009-02-05 01:26:33601git://host.xz&#91;:port&#93;/~user/path/to/repo.git/
Junio C Hamano1a4e8412005-12-27 08:17:23602</p>
603</li>
604<li>
605<p>
Junio C Hamanodbb64592007-09-01 11:17:39606ssh://&#91;user@&#93;host.xz&#91;:port&#93;/path/to/repo.git/
607</p>
608</li>
609<li>
610<p>
Junio C Hamano7ccb9fd2006-07-15 01:38:40611ssh://&#91;user@&#93;host.xz/path/to/repo.git/
Junio C Hamano1a4e8412005-12-27 08:17:23612</p>
613</li>
614<li>
615<p>
Junio C Hamano7ccb9fd2006-07-15 01:38:40616ssh://&#91;user@&#93;host.xz/~user/path/to/repo.git/
Junio C Hamano1a4e8412005-12-27 08:17:23617</p>
618</li>
619<li>
620<p>
Junio C Hamano7ccb9fd2006-07-15 01:38:40621ssh://&#91;user@&#93;host.xz/~/path/to/repo.git
Junio C Hamano1a4e8412005-12-27 08:17:23622</p>
623</li>
Junio C Hamanoba4b9282008-07-06 05:20:31624</ul></div>
Junio C Hamano1a4e8412005-12-27 08:17:23625</div></div>
Junio C Hamanoba4b9282008-07-06 05:20:31626<div class="para"><p>SSH is the default transport protocol over the network. You can
Junio C Hamanob1d6e882007-08-11 08:30:16627optionally specify which user to log-in as, and an alternate,
628scp-like syntax is also supported. Both syntaxes support
Junio C Hamanodbb64592007-09-01 11:17:39629username expansion, as does the native git protocol, but
630only the former supports port specification. The following
Junio C Hamanoba4b9282008-07-06 05:20:31631three are identical to the last three above, respectively:</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:23632<div class="exampleblock">
633<div class="exampleblock-content">
Junio C Hamanoba4b9282008-07-06 05:20:31634<div class="ilist"><ul>
Junio C Hamano1a4e8412005-12-27 08:17:23635<li>
636<p>
Junio C Hamano7ccb9fd2006-07-15 01:38:40637&#91;user@&#93;host.xz:/path/to/repo.git/
Junio C Hamano1a4e8412005-12-27 08:17:23638</p>
639</li>
640<li>
641<p>
Junio C Hamano7ccb9fd2006-07-15 01:38:40642&#91;user@&#93;host.xz:~user/path/to/repo.git/
Junio C Hamano1a4e8412005-12-27 08:17:23643</p>
644</li>
645<li>
646<p>
Junio C Hamano7ccb9fd2006-07-15 01:38:40647&#91;user@&#93;host.xz:path/to/repo.git
Junio C Hamano1a4e8412005-12-27 08:17:23648</p>
649</li>
Junio C Hamanoba4b9282008-07-06 05:20:31650</ul></div>
Junio C Hamano1a4e8412005-12-27 08:17:23651</div></div>
Junio C Hamanoba4b9282008-07-06 05:20:31652<div class="para"><p>To sync with a local directory, you can use:</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:23653<div class="exampleblock">
654<div class="exampleblock-content">
Junio C Hamanoba4b9282008-07-06 05:20:31655<div class="ilist"><ul>
Junio C Hamano1a4e8412005-12-27 08:17:23656<li>
657<p>
658/path/to/repo.git/
659</p>
660</li>
Junio C Hamanob1d6e882007-08-11 08:30:16661<li>
662<p>
663file:///path/to/repo.git/
664</p>
665</li>
Junio C Hamanoba4b9282008-07-06 05:20:31666</ul></div>
Junio C Hamano1a4e8412005-12-27 08:17:23667</div></div>
Junio C Hamanoba4b9282008-07-06 05:20:31668<div class="para"><p>They are mostly equivalent, except when cloning. See
669<a href="git-clone.html">git-clone(1)</a> for details.</p></div>
670<div class="para"><p>If there are a large number of similarly-named remote repositories and
Junio C Hamano24bc09a2008-02-28 00:27:44671you want to use a different format for them (such that the URLs you
672use will be rewritten into URLs that work), you can create a
Junio C Hamanoba4b9282008-07-06 05:20:31673configuration section of the form:</p></div>
Junio C Hamano24bc09a2008-02-28 00:27:44674<div class="listingblock">
675<div class="content">
676<pre><tt> [url "&lt;actual url base&gt;"]
677 insteadOf = &lt;other url base&gt;</tt></pre>
678</div></div>
Junio C Hamanoba4b9282008-07-06 05:20:31679<div class="para"><p>For example, with this:</p></div>
Junio C Hamano24bc09a2008-02-28 00:27:44680<div class="listingblock">
681<div class="content">
682<pre><tt> [url "git://git.host.xz/"]
683 insteadOf = host.xz:/path/to/
684 insteadOf = work:</tt></pre>
685</div></div>
Junio C Hamanoba4b9282008-07-06 05:20:31686<div class="para"><p>a URL like "work:repo.git" or like "host.xz:/path/to/repo.git" will be
687rewritten in any context that takes a URL to be "git://git.host.xz/repo.git".</p></div>
Junio C Hamano7df6dcf2009-09-13 09:51:17688<div class="para"><p>If you want to rewrite URLs for push only, you can create a
689configuration section of the form:</p></div>
690<div class="listingblock">
691<div class="content">
692<pre><tt> [url "&lt;actual url base&gt;"]
693 pushInsteadOf = &lt;other url base&gt;</tt></pre>
694</div></div>
695<div class="para"><p>For example, with this:</p></div>
696<div class="listingblock">
697<div class="content">
698<pre><tt> [url "ssh://example.org/"]
699 pushInsteadOf = git://example.org/</tt></pre>
700</div></div>
701<div class="para"><p>a URL like "git://example.org/path/to/repo.git" will be rewritten to
702"ssh://example.org/path/to/repo.git" for pushes, but pulls will still
703use the original URL.</p></div>
Junio C Hamano40f2f8d2006-02-07 08:04:39704</div>
Junio C Hamanoba4b9282008-07-06 05:20:31705<h2 id="_remotes_a_id_remotes_a">REMOTES<a id="REMOTES"></a></h2>
Junio C Hamano40f2f8d2006-02-07 08:04:39706<div class="sectionbody">
Junio C Hamanoba4b9282008-07-06 05:20:31707<div class="para"><p>The name of one of the following can be used instead
708of a URL as <tt>&lt;repository&gt;</tt> argument:</p></div>
709<div class="ilist"><ul>
Junio C Hamano054ea082008-06-01 08:26:34710<li>
711<p>
712a remote in the git configuration file: <tt>$GIT_DIR/config</tt>,
713</p>
714</li>
715<li>
716<p>
717a file in the <tt>$GIT_DIR/remotes</tt> directory, or
718</p>
719</li>
720<li>
721<p>
722a file in the <tt>$GIT_DIR/branches</tt> directory.
723</p>
724</li>
Junio C Hamanoba4b9282008-07-06 05:20:31725</ul></div>
726<div class="para"><p>All of these also allow you to omit the refspec from the command line
727because they each contain a refspec which git will use by default.</p></div>
728<h3 id="_named_remote_in_configuration_file">Named remote in configuration file</h3><div style="clear:left"></div>
729<div class="para"><p>You can choose to provide the name of a remote which you had previously
Junio C Hamano054ea082008-06-01 08:26:34730configured using <a href="git-remote.html">git-remote(1)</a>, <a href="git-config.html">git-config(1)</a>
731or even by a manual edit to the <tt>$GIT_DIR/config</tt> file. The URL of
732this remote will be used to access the repository. The refspec
733of this remote will be used by default when you do
734not provide a refspec on the command line. The entry in the
Junio C Hamanoba4b9282008-07-06 05:20:31735config file would appear like this:</p></div>
Junio C Hamano054ea082008-06-01 08:26:34736<div class="listingblock">
737<div class="content">
738<pre><tt> [remote "&lt;name&gt;"]
739 url = &lt;url&gt;
Junio C Hamano0e88f3e2009-06-21 08:03:25740 pushurl = &lt;pushurl&gt;
Junio C Hamano054ea082008-06-01 08:26:34741 push = &lt;refspec&gt;
742 fetch = &lt;refspec&gt;</tt></pre>
743</div></div>
Junio C Hamano0e88f3e2009-06-21 08:03:25744<div class="para"><p>The <tt>&lt;pushurl&gt;</tt> is used for pushes only. It is optional and defaults
745to <tt>&lt;url&gt;</tt>.</p></div>
Junio C Hamanoba4b9282008-07-06 05:20:31746<h3 id="_named_file_in_tt_git_dir_remotes_tt">Named file in <tt>$GIT_DIR/remotes</tt></h3><div style="clear:left"></div>
747<div class="para"><p>You can choose to provide the name of a
Junio C Hamano054ea082008-06-01 08:26:34748file in <tt>$GIT_DIR/remotes</tt>. The URL
749in this file will be used to access the repository. The refspec
750in this file will be used as default when you do not
751provide a refspec on the command line. This file should have the
Junio C Hamanoba4b9282008-07-06 05:20:31752following format:</p></div>
Junio C Hamano1caaf472006-12-31 08:29:35753<div class="listingblock">
Junio C Hamano1a4e8412005-12-27 08:17:23754<div class="content">
Junio C Hamanod3361ad2007-01-01 03:20:24755<pre><tt> URL: one of the above URL format
756 Push: &lt;refspec&gt;
757 Pull: &lt;refspec&gt;
758</tt></pre>
Junio C Hamano1a4e8412005-12-27 08:17:23759</div></div>
Junio C Hamanoba4b9282008-07-06 05:20:31760<div class="para"><p><tt>Push:</tt> lines are used by <em>git-push</em> and
761<tt>Pull:</tt> lines are used by <em>git-pull</em> and <em>git-fetch</em>.
Junio C Hamano054ea082008-06-01 08:26:34762Multiple <tt>Push:</tt> and <tt>Pull:</tt> lines may
Junio C Hamanoba4b9282008-07-06 05:20:31763be specified for additional branch mappings.</p></div>
764<h3 id="_named_file_in_tt_git_dir_branches_tt">Named file in <tt>$GIT_DIR/branches</tt></h3><div style="clear:left"></div>
765<div class="para"><p>You can choose to provide the name of a
Junio C Hamano054ea082008-06-01 08:26:34766file in <tt>$GIT_DIR/branches</tt>.
767The URL in this file will be used to access the repository.
Junio C Hamanoba4b9282008-07-06 05:20:31768This file should have the following format:</p></div>
Junio C Hamano1caaf472006-12-31 08:29:35769<div class="listingblock">
Junio C Hamano249572f2006-10-24 05:44:08770<div class="content">
Junio C Hamano054ea082008-06-01 08:26:34771<pre><tt> &lt;url&gt;#&lt;head&gt;</tt></pre>
Junio C Hamano249572f2006-10-24 05:44:08772</div></div>
Junio C Hamano28363492008-11-14 08:26:31773<div class="para"><p><tt>&lt;url&gt;</tt> is required; <tt>#&lt;head&gt;</tt> is optional.</p></div>
774<div class="para"><p>Depending on the operation, git will use one of the following
775refspecs, if you don't provide one on the command line.
776<tt>&lt;branch&gt;</tt> is the name of this file in <tt>$GIT_DIR/branches</tt> and
777<tt>&lt;head&gt;</tt> defaults to <tt>master</tt>.</p></div>
778<div class="para"><p>git fetch uses:</p></div>
Junio C Hamano1caaf472006-12-31 08:29:35779<div class="listingblock">
Junio C Hamano1a4e8412005-12-27 08:17:23780<div class="content">
Junio C Hamano28363492008-11-14 08:26:31781<pre><tt> refs/heads/&lt;head&gt;:refs/heads/&lt;branch&gt;</tt></pre>
782</div></div>
783<div class="para"><p>git push uses:</p></div>
784<div class="listingblock">
785<div class="content">
786<pre><tt> HEAD:refs/heads/&lt;head&gt;</tt></pre>
Junio C Hamano1a4e8412005-12-27 08:17:23787</div></div>
Junio C Hamano1a4e8412005-12-27 08:17:23788</div>
Junio C Hamanoc21ab052009-10-31 04:03:55789<h2 id="_examples">EXAMPLES</h2>
790<div class="sectionbody">
791<div class="ilist"><ul>
792<li>
793<p>
794Update the remote-tracking branches:
795</p>
796<div class="listingblock">
797<div class="content">
798<pre><tt>$ git fetch origin</tt></pre>
799</div></div>
800<div class="para"><p>The above command copies all branches from the remote refs/heads/
801namespace and stores them to the local refs/remotes/origin/ namespace,
802unless the branch.&lt;name&gt;.fetch option is used to specify a non-default
803refspec.</p></div>
804</li>
805<li>
806<p>
807Using refspecs explicitly:
808</p>
809<div class="listingblock">
810<div class="content">
811<pre><tt>$ git fetch origin +pu:pu maint:tmp</tt></pre>
812</div></div>
813<div class="para"><p>This updates (or creates, as necessary) branches <tt>pu</tt> and <tt>tmp</tt> in
814the local repository by fetching from the branches (respectively)
815<tt>pu</tt> and <tt>maint</tt> from the remote repository.</p></div>
816<div class="para"><p>The <tt>pu</tt> branch will be updated even if it is does not fast-forward,
817because it is prefixed with a plus sign; <tt>tmp</tt> will not be.</p></div>
818</li>
819</ul></div>
820</div>
Junio C Hamanoba4b9282008-07-06 05:20:31821<h2 id="_see_also">SEE ALSO</h2>
Junio C Hamano1a4e8412005-12-27 08:17:23822<div class="sectionbody">
Junio C Hamanoba4b9282008-07-06 05:20:31823<div class="para"><p><a href="git-pull.html">git-pull(1)</a></p></div>
Junio C Hamano1a4e8412005-12-27 08:17:23824</div>
Junio C Hamanoba4b9282008-07-06 05:20:31825<h2 id="_author">Author</h2>
Junio C Hamano1a4e8412005-12-27 08:17:23826<div class="sectionbody">
Junio C Hamanoba4b9282008-07-06 05:20:31827<div class="para"><p>Written by Linus Torvalds &lt;torvalds@osdl.org&gt; and
Junio C Hamano0868a302008-07-22 09:20:44828Junio C Hamano &lt;gitster@pobox.com&gt;</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:23829</div>
Junio C Hamanoba4b9282008-07-06 05:20:31830<h2 id="_documentation">Documentation</h2>
Junio C Hamano1a4e8412005-12-27 08:17:23831<div class="sectionbody">
Junio C Hamanoba4b9282008-07-06 05:20:31832<div class="para"><p>Documentation by David Greaves, Junio C Hamano and the git-list &lt;git@vger.kernel.org&gt;.</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:23833</div>
Junio C Hamanoba4b9282008-07-06 05:20:31834<h2 id="_git">GIT</h2>
Junio C Hamano1a4e8412005-12-27 08:17:23835<div class="sectionbody">
Junio C Hamanoba4b9282008-07-06 05:20:31836<div class="para"><p>Part of the <a href="git.html">git(1)</a> suite</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:23837</div>
838<div id="footer">
839<div id="footer-text">
Junio C Hamano3f680f32009-11-16 02:10:54840Last updated 2009-11-16 02:10:11 UTC
Junio C Hamano1a4e8412005-12-27 08:17:23841</div>
842</div>
843</body>
844</html>